package 备忘录模式

type iRecoder interface {
	Recode(*stock)
}

type stock struct {
	value float32
}

type recoder struct {
	state float32
}

func (s *stock) double() {
	s.value *= 2
}

func (s *stock) half() {
	s.value /= 2
}

func NewStock(v float32) *stock {
	return &stock{value: v}
}

// 重点
func (s *stock) createRecoder() *recoder {
	return &recoder{state: s.value}
}

func (r *recoder) Recode(s *stock) {
	r.state = s.value

}

//这里少一个reinstate function
